<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="common/include :: header('修改流程定义')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-bpmnInfo-edit" >
        <div class="form-group">
            <label class="col-sm-3 control-label">流程类型：</label>
            <div class="col-sm-8">
                <select name="bpmnType" class="form-control m-b" th:with="type=${@dict.getType('bus_audit_type')}">
                    <option th:each="dict : ${type}" th:text="${dict.label}" th:value="${dict.value}"></option>
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">流程文件：</label>
            <div class="col-sm-8">
                <input type="file" name="bpmnFile">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">备注信息：</label>
            <div class="col-sm-8">
                <textarea name="info" class="form-control"></textarea>
            </div>
        </div>
    </form>
</div>
<th:block th:include="common/include :: footer" />
<script th:inline="javascript">
    var prefix = ctx + "/business/bpmnInfo";
    //提交判断  submitHandler  脚手架自带的方法
        function submitHandler() {
            if ($.validate.form()){
              var bpmnFile=  $('[name="bpmnFile"]')[0].files[0];
              if (!bpmnFile){
                  $.modal.alertWarning("请选择文件")
                  return;
              }
              //发送AJaX 文件
                var fd=new FormData();
               fd.append("bpmnType",$('[name="bpmnType"] option:selected').val());
               fd.append("info",$('[name="info"]').val());
               fd.append("bpmnFile",bpmnFile);
               fd.append("bpmnLabel",$('[name="bpmnType"] option:selected').text());
               $.ajax({
                   url:prefix+'/deploy',
                   type:'post',
                   data:fd,
                   processData:false,
                   contentType:false,
                   success:function (data) {
                       $.operate.successCallback(data);
                   }
               })
            }
        }
</script>
</body>
</html>